import { OBJLoader } from "three/addons/loaders/OBJLoader.js";
import { OrbitControls } from "three/addons/controls/OrbitControls.js";
export function loadTemptor(scene) {
  var loader = new OBJLoader();
  var renderer = new THREE.WebGLRenderer({
    canvas: document.getElementById("mainCanvas"),
  });
  renderer.setClearColor("grey"); // 设置渲染器背景为黑色

  loader.load("https://bzayyz.gitee.io/threejsdemo/threejsdemo/cadasserts1/output/wenduji.obj", function (geometry) {
    // console.log(1,geometry);
    // 创建Mesh对象
    // const material = new THREE.MeshLambertMaterial({ color: "grey" });
    //创建物体
    var camera = new THREE.OrthographicCamera(-65, 65, 45, -45, 0, 500); //创建照相机
    camera.position.set(35, 15, 25); //设置照相机的位置
    // const cube=new THREE.Mesh(geometry)
    // console.log(cube)
    camera.lookAt(geometry.position); //设置照相机面向(0,0,0)坐标观察
    scene.add(geometry);
    function render() {
      renderer.render(scene, camera); //执行渲染操作
    }
    render();
    var controls = new OrbitControls(camera, renderer.domElement); //创建控件对象
    controls.addEventListener("change", render); //监听鼠标、键盘事件
  });
}
